home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / libg_261.zip / libg_261 / libg++ / src / gen / OXPBag.hP < prev    next >
Text File  |  1992-12-22  |  1KB  |  74 lines

  1. #ifndef _<T>OXPBag_h
  2. #ifdef __GNUG__
  3. #pragma interface
  4. #endif
  5. #define _<T>OXPBag_h 1
  6.  
  7. #include "<T>.Bag.h"
  8. #include "<T>.XPlex.h"
  9.  
  10. class <T>OXPBag : public <T>Bag
  11. {
  12. protected:
  13.   <T>XPlex       p;
  14.  
  15. public:
  16.                 <T>OXPBag(int chunksize = DEFAULT_INITIAL_CAPACITY);
  17.                 <T>OXPBag(const <T>OXPBag&);
  18.  
  19.   Pix           add(<T&> item);
  20.   void          del(<T&> item);
  21. #undef remove
  22.   void          remove(<T&>item);
  23.   int           nof(<T&> item);
  24.   int           contains(<T&> item);
  25.  
  26.   void          clear();
  27.  
  28.   Pix           first();
  29.   void          next(Pix& i);
  30.   <T>&          operator () (Pix i);
  31.   int           owns(Pix i);
  32.   Pix           seek(<T&> item, Pix from = 0);
  33.  
  34.   int           OK();
  35. };
  36.  
  37.  
  38. inline <T>OXPBag::<T>OXPBag(int chunksize) 
  39.      : p(chunksize) { count = 0; }
  40.  
  41. inline <T>OXPBag::<T>OXPBag(const <T>OXPBag& s) : p(s.p) { count = s.count; }
  42.  
  43. inline Pix <T>OXPBag::first()
  44. {
  45.   return p.first();
  46. }
  47.  
  48. inline void <T>OXPBag::next(Pix  & idx)
  49. {
  50.   p.next(idx);
  51. }
  52.  
  53. inline <T>& <T>OXPBag::operator ()(Pix   idx)
  54. {
  55.   return p(idx);
  56. }
  57.  
  58. inline void <T>OXPBag::clear()
  59. {
  60.   count = 0;  p.clear();
  61. }
  62.  
  63. inline int <T>OXPBag::owns (Pix   idx)
  64. {
  65.   return p.owns(idx);
  66. }
  67.  
  68. inline int <T>OXPBag::contains(<T&> item)
  69. {
  70.   return seek(item) != 0;
  71. }
  72.  
  73. #endif
  74.